/*
 *
带参构造函数
当前日期是: 2023-3-25
无参构造函数
当前日期是: 1970-1-1
类型转换构造函数
当前日期是: 2023-3-25

 *
 */

#include <iostream>

using namespace std;

class Date{
private:
	int year;
	int month;
	int day;
public:
	Date(int year, int month, int day): year(year), month(month), day(day){
		cout << "带参构造函数" << endl;
	}

	Date(void): year(1970), month(1), day(1){
		cout << "无参构造函数" << endl;
	}

	Date(int number){
		cout << "类型转换构造函数" << endl;
		year = number / 10000;
		int remain = number % 10000;
		month = remain / 100;
		day = remain % 100;
	}
	void print(void){
		cout << "当前日期是: " << year << "-" << month << "-" << day << endl;
	}
};


int main(void){
	//带参构造函数
	Date date1(2023, 03, 25);
	date1.print();

	//无参构造函数
	Date date2;
	date2.print();

	//类型转换构造函数
	Date date3 = 20230325;
	date3.print();
	return 0;
}
